<?php

class Ads_Model_State {

    private $_dbtable;

    public function __construct() {
        $this->_dbtable = new Ads_Model_DbTable_State();
    }

    public function fetchAll() {
        $select = $this->_dbtable->select();
        return $this->_dbtable->fetchAll($select);
    }

    public function getStateById($id) {
        $select = $this->_dbtable->select();
        $select->where("id = ? ", $id);
        return $this->_dbtable->fetchAll($select);
    }

    public function getIdByState($state) {
        $select = $this->_dbtable->select();
        $select->where("name = ?", $state);
        return $this->_dbtable->fetchAll($select);
    }

    public function updateState($data, $id) {
        $this->_dbtable->update($data, "id = $id ");
    }

    public function insert($data) {
        $this->_dbtable->insert($data);
    }
    
}

